<!-- 我的页面下 有奖任务页面 -->
<!-- 我的页面下 有奖任务页面 -->
<template>
	<view>
		<global-navgation title="有奖任务"></global-navgation>
		
		<view class="task-relus">
			<view class="relus">
				任务规则
			</view>
			<p class="content">请输入任务实施内容请输入任务实施内容请输入任务实施内容请输入任务实施内容请输入任务实施内容请输入任务实施内容请输入任务实施内容请输入任务实容请输入任务实!
			</p>
		</view>
		
		<view class="text-container">
			<textarea value="" placeholder="请输入任务实施内容" />
		</view>
		
		<view class="img-container">
			<view class="img-list">
			<view class="img-item" v-for="(v,i) in imgArr" :key="i">
				<view class="item-content">
					<view class="iconfont icon-shanchu icon" @click="deleteImg(i)"></view>
					<image :src="v" lazy-load="true" @click="previewImg(v)"></image>
				</view>
			</view>
			
			
			<view class="img-item" @click="chooseImg()">
				<view class="iconfont icon-ziyuan icon"></view>
			</view>
		    </view>
		</view>
		
		<view class="submit">
			<button type="default" >提交</button>
		</view>
	</view>
</template>

<script>
	import globalNavgation from '../../../components/globalNavgation.vue'
	export default {
		components:{
			globalNavgation
		},
		data() {
			return {
				imgArr:[]
			}
		},
		onLoad(){
			uni.getStorage({
			    key: 'token',
			    success:  res=> {
					this.tokens=res.data
					console.log('mmm',this.tokens)
			    }
			});
		},
		methods: {
			skipComplaint(){
				uni.navigateTo({
					url:'complaintSussess'
				})
			},
			chooseImg(){
				uni.chooseImage({
					count:6,
					sizeType: ['original', 'compressed'], 
					    sourceType: ['album'], 
					    success: res =>{
							if(this.imgArr.length===0){
								this.imgArr = res.tempFilePaths
							}else{
								this.imgArr.push(...res.tempFilePaths)
							}
					    }
				})
			},
			deleteImg(i){
				this.imgArr.splice(i,1)
			},
			previewImg(v){
				uni.previewImage({
					current:v,
					urls:this.imgArr,
					loop:true
				})
			}
		}
	}
</script>

<style scoped>
	.task-relus{
		width: 686rpx;
		height: 200rpx;
		background: rgba(57, 101, 255, 0.08);
		border: 1px solid rgba(57, 101, 255, 0.25);
		box-sizing: border-box;
		border-radius: 8rpx;
		margin: 0 auto;
		font-family: PingFang SC;
		font-style: normal;
		font-weight: 600;
		font-size: 28rpx;
		color: #3965FF;
	}
	.task-relus .content{
		width: 638rpx;
		height: 102rpx;
		margin: 0 auto;
		font-size: 24rpx;
		color: rgba(57, 101, 255, 0.85);
		opacity: 0.65;
		white-space:normal;
		word-break:break-all;
		line-height: 34rpx;
	}
	
	.task-relus .relus{
		margin:24rpx 0 4rpx 24rpx;
	}
	
.text-container{
	margin: 0 auto;
	width: 690rpx;
	height: 300rpx;
}
.text-container textarea{
	width: 100%;
	padding-top: 48rpx;
	font-family: PingFang SC;
	font-style: normal;
	font-weight: normal;
	font-size: 32rpx;
	letter-spacing: -0.408px;
	color: rgba(0, 0, 0, 0.25);
}

.img-container{
	width: 100%;
	margin-top: 44rpx;
}

.img-container .img-list{
	width: 690rpx;
	height: 326rpx;
	margin: 0 auto;
	display: flex;
	flex-flow: row wrap;
}

.img-container .img-list .img-item{
	width: 144rpx;
	height: 144rpx;
	margin-right: 38rpx;
	margin-bottom: 38rpx;
}

.img-container .img-list .img-item:nth-child(4n){
	margin-right: 0rpx;
}

.img-container .img-list .img-item .item-content{
	width: 100%;
	height: 100%;
	position: relative;
}

.img-container .img-list .img-item .item-content .icon{
	color: #EB5757;
	position: absolute;
	z-index: 1;
	font-size: 36rpx;
	top: -18rpx;
	right: -18rpx;
}

.img-container .img-list .img-item .item-content image{
	width: 100%;
	height: 100%;
	vertical-align: top;
}

.img-container .img-list .img-item:last-child{
	width: 144rpx;
	height: 144rpx;
	border: 1px solid rgba(0, 0, 0, 0.1);
	box-sizing: border-box;
	border-radius: 4px;
	text-align: center;
	line-height: 144rpx;
	margin-top: 0;
}

.img-container .img-list .img-item .icon{
	font-size: 60rpx;
	color: rgba(0, 0, 0, 0.25);
}

.submit{
	width: 100%;
	height: 140rpx;
	position: absolute;
	bottom: 0;
	box-shadow: 0px -2px 8px rgba(0, 0, 0, 0.08);
}
.submit button{
	margin-top: 20rpx;
	width:686rpx;
	height: 100rpx;
	text-align: center;
	line-height: 100rpx;
	font-family: PingFang SC;
	font-style: normal;
	font-weight: normal;
	font-size: 36rpx;
	color: #F7F7F7;
	background: linear-gradient(90deg, #3965FF 0%, rgba(57, 101, 255, 0.8) 100%);
	border-radius: 4px;
}
</style>